想先找到這個 function 如何回傳結果,推測是存到傳入的 const NODE *node。經過 macro COMPILE 可以找到 iseq_compile_each, iseq_compile_each0,在其中 switch-case 看到相關實作。
要進一步理解的話,需要知道 NODE 結構的意義。但同時,又需要從使用 NODE 的程式,反過來理解結構的使用方式。找不到 top-down 的說明文件。
在 rb_iseq_compile_node 裡,實際 compile instruction 前,會先用 prepare_iseq_build 設定 rb_iseq_t *iseq 內容。其中抓出來要特別看的是 type。
簡略整理要能執行 Ruby program,YARV 需要的資訊:
enum node_type)從 function 裡抓一下關鍵字:
從 NODE struct 看到 u1, u2, u3,需要知道怎麼使用